﻿@{
    ViewBag.Title = "用户列表";
    ViewBag.MenuIndex = 5;
}
@model IPagedList<Xwork.SEO.User>
<div class="ny">
    <div class="ny_kb9"></div>
    <table id="myTable" style="width:990px; margin-bottom:10px;" class="tablesorter" border="0" cellpadding="0" cellspacing="0">
    	<thead>
        	<tr class="even">
                <th width="19%"><h3>用户名</h3></th>
                <th><h3>类型</h3></th>
                <th><h3>余额</h3></th>
                <th><h3>关键词数量</h3></th>
                <th><h3>累积消费</h3></th>
                <th><h3>关键词达标率</h3></th>
                <th><h3>创建日期</h3></th>
                <th><h3>状态</h3></th>
                <th><h3>管理</h3></th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                <td>@item.Email</td>
                <td>@(item.IsAdmin ? (item.ID == 1 ? "超管" : "管理员") : "普通用户")</td>
                <td>@item.UseableAmount</td>
                <td>@item.TopupAmount</td>
                <td>累积消费</td>
                <td>关键词达标率</td>
                <td>创建日期</td>
                <td>@item.IsAuthenticated</td>
                <td><input type="button" value="设为已审核" onclick="setAuthed(@item.ID)" /></td>
                </tr>
            }
        </tbody>
    </table>
    <div  style="text-align:right; padding-right:10px;">
        @Html.PagedListPager(Model, p => Url.Action("userlist", new { pageindex = p }))
    </div>
</div>
<script type="text/javascript">
    function setAuthed(id)
    {
        $.post('@Url.Action("setAuthed")',{id:id},function(d){
            if(d.error){
                alert(d.error);
            }else
            {
                alert(d);
                window.location.href=window.location.href;
            }
        });
    }

</script>